package com.situ.allaia.service.impl;

import com.situ.allaia.dao.UserAddressDao;
import com.situ.allaia.model.UserAddress;
import com.situ.allaia.service.UserAddressService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 功能：
 *
 * @author 千堆雪
 * @version 1.0.0
 * @since 2023/9/13
 * <p>
 * created by 千堆雪 on 2023/9/13, last modified by 千堆雪 on 2023/9/13
 */
@Service
public class UserAddressServiceImpl implements UserAddressService {
    private final UserAddressDao userAddressDao;

    public UserAddressServiceImpl(UserAddressDao userAddressDao) {
        this.userAddressDao = userAddressDao;
    }

    @Override
    public List<UserAddress> findByUserId(Integer userId) {
        return userAddressDao.findByUserId(userId);
    }

    @Override
    public UserAddress findById(Integer id) {
        return userAddressDao.findById(id);
    }

    @Override
    public boolean insert(UserAddress userAddress) {
        return userAddressDao.insert(userAddress)>0;
    }

    @Override
    public boolean update(UserAddress userAddress) {
        return userAddressDao.update(userAddress)>0;
    }
}
